
package cn.gov.service.impl;

import cn.geracomium.util.service.abs.AbstractService;
import cn.gov.dao.IProvinceAndCityDAO;
import cn.gov.dao.IServiceStationDAO;
import cn.gov.service.ICityAndProvinceService;
import cn.gov.service.IServiceStationService;
import cn.gov.vo.Area;
import cn.gov.vo.City;
import cn.gov.vo.Province;
import cn.gov.vo.ServiceStation;
import com.alibaba.dubbo.config.annotation.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CityAndProvinceServiceImpl extends AbstractService implements ICityAndProvinceService {

    @Resource
    private IProvinceAndCityDAO dao;

    @Override
    public List<Province> getAllProvince(){

        return  this.dao.findAllProvince() ;
    };
    @Override
    public List<City> getCityByProvince(String province){
        int pid = this.dao.findPidByProvince(province);
        return this.dao.findAllCityByProvince(pid);
    };



    @Override
    public List<Area> getAreaByPc(String province,String city){
        int pid = this.dao.findPidByProvince(province) ;
        int cid = this.dao.findCIdByCity(city);
        HashMap<String,Integer> map = new HashMap<String,Integer>();
        map.put("pid",pid);
        map.put("cid",cid);
        return this.dao.findByPC(map) ;
    }
}

